package com.tank.jdk8.collecet;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collector;

/**
 * Created with IntelliJ IDEA.
 * User: SuQiEr
 * Date:2017/4/8 0008
 * Time: 下午 5:48
 * To change this template use File | Settings | File Templates.
 */
@Slf4j
public class CollectorsTest {

    @Test
    public void test(){

        List<String> list = new ArrayList<>();
        list.add("zhangsan");
        list.add("lisi");
        list.add("wangwu");

//        list.stream().forEach(item -> {
//            log.info("item:{}", item);
//            if("lisi".equals(item)){
//                log.info("find user list");
//                return;
//            }
//        });

       boolean flag =  list.stream().anyMatch(item ->
           item.equals("lisi")
        );

        log.info("flag:{}", flag);
    }
}











